﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;

namespace KP_CommonLibrary.KP_CoreUI
{
    public partial class KP_UCListVoucher : KP_CommonLibrary.KP_CommonControls.KP_UserControl
    {
        #region Fields

        #endregion
        #region Properties

        KP_Business.KP_BLVoucherBase Business { get; set; }

        public DataSet DataSource
        {
            get
            {
                return MasterBindingSource.DataSource as DataSet;
            }
            set
            {
                if (value == null)
                {
                    DetailBindingSource.DataMember = "";
                    MasterBindingSource.DataMember = "";
                    if (MasterBindingSource.DataSource != null)
                    {
                        object oldData = MasterBindingSource.DataSource;
                        MasterBindingSource.DataSource = value;
                        (oldData as DataSet).Dispose();
                    }
                }
                else
                {
                    MasterBindingSource.DataSource = value;
                    MasterBindingSource.DataMember = Business.MasterTable;
                    DetailBindingSource.DataMember = Business.RelationName;
                }
            }
        }
        #endregion
        public KP_UCListVoucher()
        {
            InitializeComponent();
            //DataTable tblTemp = new DataTable();            
        }

        #region Custom Method

        #endregion
        #region Virtual Method
        
        #endregion

        #region Override Method
        public override bool DispatchCmdKey(ref Message msg, Keys keyData)
        {
            return kpucNavVoucher1.DispatchCmdKey(ref msg, keyData);
        }
        #endregion

        #region event implement
        #endregion

    }
}
